package cn.crex1.xiaomi.core.orm.template.excute;

import cn.crex1.xiaomi.core.orm.datasource.JdbcDataSource;
import cn.crex1.xiaomi.core.orm.mapper.MapperProxy;
import cn.crex1.xiaomi.core.orm.mapper.MapperRegistry;
import cn.crex1.xiaomi.core.orm.template.QueryTemplate;

public class ExcuteQueryTemplate implements QueryTemplate{
	private MapperRegistry mapperRegistry;
	private JdbcDataSource dataSource;
	
	public ExcuteQueryTemplate() {
		mapperRegistry=new MapperRegistry();
		dataSource=new JdbcDataSource();
	}

	@Override
	public <T> T getmapper(Class<?> clazz, Object... args) {
		return mapperRegistry.getMapper(dataSource, clazz, args);
	}
	public void close() {
		dataSource.closeDataSource();
	}
}
